package com.github.admin.edu.security.jwt.server.domain;

import com.github.admin.edu.orm.repository.CustomRepository;
import com.github.admin.edu.security.jwt.server.entity.TSysRoleUser;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * user:wangj
 * date:2018/8/12
 * Time: 19:25
 */
public interface ServerUserRoleManagerDomain extends CustomRepository<TSysRoleUser,Long> {


    @Query("select t from TSysRoleUser t where t.userid =:userId and t.roleid=:roleId")
    List<TSysRoleUser> getAllByUseridAndRoleid(@Param("userId")String userId,@Param("roleId") Integer roleId);

    @Query("select t from TSysRoleUser t where t.userid=:userId ")
    List<TSysRoleUser> getAllByUserid(@Param("userId")String userId);

}
